package cn.lyh.myiot.controller;

import cn.lyh.myiot.pojo.WenshiduTable;
import cn.lyh.myiot.service.WenshiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author lyh
 * @version 1.0
 * @date 2020/8/13
 */
@RestController()
public class MyIOTController {

    final
    WenshiduService wenshiduService;

    @Value("#{new java.util.HashMap()}")
    Map<String,Object> mapJson;

    public MyIOTController(WenshiduService wenshiduService) {
        this.wenshiduService = wenshiduService;
    }

    @GetMapping("/test")
    public Map<String,Object> getWenshidu(){
        mapJson.clear();
        List<WenshiduTable> wenshidu = wenshiduService.getWenshidu();
        mapJson.put("code","200");
        mapJson.put("data",wenshidu);
        return mapJson;
    }

}
